/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * BuildTrainingPanel.java
 *
 * Created on Jun 3, 2010, 1:44:44 AM
 */

package GUI;

import TextNor.Initial.NorPunc;

import BuildTrainSet.AssignTag.AlphaTag;
import BuildTrainSet.AssignTag.AlphaTagPro;
import BuildTrainSet.AssignTag.GreekTag;
import BuildTrainSet.AssignTag.Group;
import BuildTrainSet.AssignTag.NumTag;
import BuildTrainSet.AssignTag.NumTag_AssignCom;
import BuildTrainSet.AssignTag.NumTag_SplitCom;
import BuildTrainSet.AssignTag.OtherTag;
import BuildTrainSet.Expand.Expand;
import BuildTrainSet.Initial.DetectGroup;
import BuildTrainSet.Initial.DetectNSW;
import BuildTrainSet.Initial.Split;
import BuildTrainSet.Read.ReadNgangCheo;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JFileChooser;
import javax.xml.stream.XMLStreamException;

/**
 *
 * @author Kiennt
 */
public class BuildTrainingPanel extends javax.swing.JPanel {

    /** Creates new form BuildTrainingPanel */
    public BuildTrainingPanel() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        txtFileName = new javax.swing.JTextField();
        jPanel4 = new javax.swing.JPanel();
        ckPhanNhom = new javax.swing.JCheckBox();
        jPanel5 = new javax.swing.JPanel();
        ckPhanLoaiNSWSoSoBo = new javax.swing.JCheckBox();
        ckPhanLoaiNCOM = new javax.swing.JCheckBox();
        ckPhanTachNCOM = new javax.swing.JCheckBox();
        jPanel6 = new javax.swing.JPanel();
        ckPhanLoaiGrek = new javax.swing.JCheckBox();
        ckPhanLoaiNSWChu = new javax.swing.JCheckBox();
        ckPhanLoaiNSWChuPro = new javax.swing.JCheckBox();
        jPanel9 = new javax.swing.JPanel();
        ckPhanLoaiNSWKhac = new javax.swing.JCheckBox();
        btnChonFile = new javax.swing.JButton();
        jLabel3 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        ckPhatHienNSW = new javax.swing.JCheckBox();
        btnThucHien = new javax.swing.JButton();
        jPanel10 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        txtTB = new javax.swing.JTextArea();
        jPanel1 = new javax.swing.JPanel();
        ckChuanPhanTach = new javax.swing.JCheckBox();
        jPanel8 = new javax.swing.JPanel();
        ckXacDinhCachDoc = new javax.swing.JCheckBox();
        jPanel7 = new javax.swing.JPanel();
        ckKhoiPhucTuVietTat = new javax.swing.JCheckBox();
        jPanel3 = new javax.swing.JPanel();
        ckPhatHienNhom = new javax.swing.JCheckBox();
        ckPhanTachNSW = new javax.swing.JCheckBox();

        setBackground(java.awt.Color.white);
        setPreferredSize(new java.awt.Dimension(1000, 600));

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 14));
        jLabel1.setText("XÂY DỰNG TẬP HUẤN LUYỆN");

        jPanel4.setBackground(java.awt.Color.white);
        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("Phân loại NSW"));

        ckPhanNhom.setBackground(java.awt.Color.white);
        ckPhanNhom.setText("Phân nhóm");

        jPanel5.setBackground(java.awt.Color.white);
        jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder("Phân loại NSW nhóm số"));

        ckPhanLoaiNSWSoSoBo.setBackground(java.awt.Color.white);
        ckPhanLoaiNSWSoSoBo.setText("Phân loại NSW số sơ bộ");

        ckPhanLoaiNCOM.setBackground(java.awt.Color.white);
        ckPhanLoaiNCOM.setText("Phan loại NCOM");

        ckPhanTachNCOM.setBackground(java.awt.Color.white);
        ckPhanTachNCOM.setText("Phân tách NCOM");

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(ckPhanLoaiNSWSoSoBo)
                    .addComponent(ckPhanTachNCOM)
                    .addComponent(ckPhanLoaiNCOM))
                .addContainerGap(72, Short.MAX_VALUE))
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addComponent(ckPhanLoaiNSWSoSoBo, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(ckPhanTachNCOM)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(ckPhanLoaiNCOM, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel6.setBackground(java.awt.Color.white);
        jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder("Phân loại NSW nhóm chữ"));

        ckPhanLoaiGrek.setBackground(java.awt.Color.white);
        ckPhanLoaiGrek.setText("Phân loại NSW số Hi Lạp");

        ckPhanLoaiNSWChu.setBackground(java.awt.Color.white);
        ckPhanLoaiNSWChu.setText("Phân loại NSW ASWD, SEQN, EXPN");

        ckPhanLoaiNSWChuPro.setBackground(java.awt.Color.white);
        ckPhanLoaiNSWChuPro.setText("Phân loại NSW ASWD, SEQN, EXPN pro");

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(ckPhanLoaiGrek)
                    .addComponent(ckPhanLoaiNSWChu)
                    .addComponent(ckPhanLoaiNSWChuPro, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addComponent(ckPhanLoaiGrek, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(ckPhanLoaiNSWChu, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(ckPhanLoaiNSWChuPro)
                .addContainerGap())
        );

        jPanel9.setBackground(java.awt.Color.white);
        jPanel9.setBorder(javax.swing.BorderFactory.createTitledBorder("Phân loại NSW nhóm khác"));

        ckPhanLoaiNSWKhac.setBackground(java.awt.Color.white);
        ckPhanLoaiNSWKhac.setText("Phân loại NSW nhóm khác");

        javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
        jPanel9.setLayout(jPanel9Layout);
        jPanel9Layout.setHorizontalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup()
                .addComponent(ckPhanLoaiNSWKhac)
                .addContainerGap(60, Short.MAX_VALUE))
        );
        jPanel9Layout.setVerticalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(ckPhanLoaiNSWKhac)
                .addContainerGap())
        );

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(ckPhanNhom))
                    .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, 225, Short.MAX_VALUE)
                    .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addComponent(ckPhanNhom)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        btnChonFile.setText("Chọn");
        btnChonFile.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btnChonFileMouseClicked(evt);
            }
        });
        btnChonFile.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnChonFileActionPerformed(evt);
            }
        });

        jLabel3.setText("Chọn file");

        jPanel2.setBackground(java.awt.Color.white);
        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Phát hiện NSW"));

        ckPhatHienNSW.setBackground(java.awt.Color.white);
        ckPhatHienNSW.setText("Phát hiện NSW");

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(ckPhatHienNSW, javax.swing.GroupLayout.PREFERRED_SIZE, 126, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(ckPhatHienNSW, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        btnThucHien.setText("Thực hiện");
        btnThucHien.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                btnThucHienMouseClicked(evt);
            }
        });

        jPanel10.setBackground(java.awt.Color.white);
        jPanel10.setBorder(javax.swing.BorderFactory.createTitledBorder("Thông báo"));

        txtTB.setColumns(20);
        txtTB.setRows(5);
        jScrollPane1.setViewportView(txtTB);

        javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
        jPanel10.setLayout(jPanel10Layout);
        jPanel10Layout.setHorizontalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel10Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel10Layout.setVerticalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel10Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 149, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(32, 32, 32))
        );

        jPanel1.setBackground(java.awt.Color.white);
        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Chuẩn phân tách"));

        ckChuanPhanTach.setBackground(java.awt.Color.white);
        ckChuanPhanTach.setText("Chuẩn phân tách");
        ckChuanPhanTach.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ckChuanPhanTachActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(ckChuanPhanTach, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(ckChuanPhanTach, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
        );

        jPanel8.setBackground(java.awt.Color.white);
        jPanel8.setBorder(javax.swing.BorderFactory.createTitledBorder("Xác định cách đọc cho - và /"));

        ckXacDinhCachDoc.setBackground(java.awt.Color.white);
        ckXacDinhCachDoc.setText("Xác định cách đọc cho dấu - và /");
        ckXacDinhCachDoc.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ckXacDinhCachDocActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(ckXacDinhCachDoc)
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addContainerGap(18, Short.MAX_VALUE)
                .addComponent(ckXacDinhCachDoc, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        jPanel7.setBackground(java.awt.Color.white);
        jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder("Khôi phục từ viết tắt"));

        ckKhoiPhucTuVietTat.setBackground(java.awt.Color.white);
        ckKhoiPhucTuVietTat.setText("Khôi phục từ viết tắt");

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addComponent(ckKhoiPhucTuVietTat)
                .addContainerGap(54, Short.MAX_VALUE))
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(ckKhoiPhucTuVietTat, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel3.setBackground(java.awt.Color.white);
        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Phân tách"));

        ckPhatHienNhom.setBackground(java.awt.Color.white);
        ckPhatHienNhom.setText("Phát hiện nhóm");
        ckPhatHienNhom.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ckPhatHienNhomActionPerformed(evt);
            }
        });

        ckPhanTachNSW.setBackground(java.awt.Color.white);
        ckPhanTachNSW.setText("Phân tách NSW");

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(ckPhatHienNhom)
                    .addComponent(ckPhanTachNSW, javax.swing.GroupLayout.PREFERRED_SIZE, 108, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(30, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addComponent(ckPhatHienNhom)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(ckPhanTachNSW, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(159, 159, 159)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel3)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(txtFileName, javax.swing.GroupLayout.PREFERRED_SIZE, 490, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(btnChonFile, javax.swing.GroupLayout.PREFERRED_SIZE, 67, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup()
                                        .addGap(28, 28, 28)
                                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                                .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                                            .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                    .addGroup(layout.createSequentialGroup()
                                        .addGap(47, 47, 47)
                                        .addComponent(btnThucHien)))
                                .addGap(18, 18, 18)
                                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(366, 366, 366)
                        .addComponent(jLabel1)))
                .addContainerGap(187, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addGap(56, 56, 56)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(txtFileName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnChonFile))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(13, 13, 13)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(63, 63, 63)
                                .addComponent(btnThucHien, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(layout.createSequentialGroup()
                        .addGap(18, 18, 18)
                        .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jPanel10, 0, 206, Short.MAX_VALUE)))
                .addGap(119, 119, 119))
        );
    }// </editor-fold>//GEN-END:initComponents

    private void btnChonFileMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnChonFileMouseClicked
        // TODO add your handling code here:
        JFileChooser fileChooser = new JFileChooser();
        fileChooser.setSelectedFile(new File("E://Project//TextNorDemo//trainset"));
        int returnVal = fileChooser.showOpenDialog(this);
        if (returnVal == JFileChooser.APPROVE_OPTION) {
            File file = fileChooser.getSelectedFile();
            txtFileName.setText(file.getName());
            // ... code that loads the contents of the file in the text area
        } else {
            // ...
        }
    }//GEN-LAST:event_btnChonFileMouseClicked

    private void btnChonFileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnChonFileActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_btnChonFileActionPerformed

    private void btnThucHienMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnThucHienMouseClicked
        // TODO add your handling code here:
         String fileName=txtFileName.getText();
        String inf="trainset\\"+fileName.substring(0,fileName.length()-4);
        if(ckChuanPhanTach.isSelected()){
            try {
                NorPunc np = new NorPunc(inf + ".xml", inf + "_punc.xml");
            } catch (XMLStreamException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (FileNotFoundException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            }
           
            txtTB.append("Chuẩn phân tách...\n");
        }
        if(ckPhatHienNSW.isSelected()){
            try {
                DetectNSW dtn = new DetectNSW(inf + "_punc.xml", inf + "_punc_nsw.xml");
            } catch (XMLStreamException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (FileNotFoundException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            }
            
            txtTB.append("Phát hiện NSW...\n");
        }

        if(ckPhatHienNhom.isSelected()){
            try {
                DetectGroup dtu = new DetectGroup(inf + "_punc_nsw.xml", inf + "_punc_nsw_gr.xml");
            } catch (XMLStreamException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (FileNotFoundException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            }
            
            txtTB.append("Phát hiện nhóm...\n");
        }
        
        if(ckPhanTachNSW.isSelected()){
            try {
                Split sp = new Split(inf + "_punc_nsw_gr.xml", inf + "_punc_nsw_gr_split.xml");
            } catch (XMLStreamException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (FileNotFoundException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            }
            txtTB.append("Phân tách NSW phức...\n");
        }
        if(ckPhanNhom.isSelected()){
            try {
                Group gtag = new Group(inf + "_punc_nsw_gr_split.xml", inf + "_punc_nsw_gr_split_group.xml");
            } catch (XMLStreamException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            }
            txtTB.append("Phân nhóm NSW...\n");
        }
        
        if(ckPhanLoaiNSWSoSoBo.isSelected()){
            try {
                NumTag ntag = new NumTag(inf + "_punc_nsw_gr_split_group.xml", inf + "_punc_nsw_gr_split_group_num.xml");
            } catch (XMLStreamException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            }
            txtTB.append("Phân loại NSW số sơ bộ...\n");
        }

        if(ckPhanTachNCOM.isSelected()){
            try {
                NumTag_SplitCom ntsc = new NumTag_SplitCom(inf + "_punc_nsw_gr_split_group_num.xml", inf + "_punc_nsw_gr_split_group_num_splitCom.xml");
            } catch (UnsupportedEncodingException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (FileNotFoundException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (XMLStreamException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            }
            txtTB.append("Phân tách NCOM...\n");
        }
        if(ckPhanLoaiNCOM.isSelected()){
            try {
                NumTag_AssignCom ntac = new NumTag_AssignCom(inf + "_punc_nsw_gr_split_group_num_splitCom.xml", inf + "_punc_nsw_gr_split_group_num_splitCom_asignCom.xml");
            } catch (XMLStreamException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            }
            txtTB.append("Phân loại NCOM...\n");
        }

        if(ckPhanLoaiGrek.isSelected()){
            try {
                GreekTag gt = new GreekTag(inf + "_punc_nsw_gr_split_group_num_splitCom_asignCom.xml", inf + "_punc_nsw_gr_split_group_num_splitCom_asignCom_greek.xml");
            } catch (FileNotFoundException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (XMLStreamException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            }
            txtTB.append("Phân loại số Hi Lạp...\n");
        }
        if(ckPhanLoaiNSWChu.isSelected()){
            try {
                AlphaTag at = new AlphaTag(inf + "_punc_nsw_gr_split_group_num_splitCom_asignCom_greek.xml", inf + "_punc_nsw_gr_split_group_num_splitCom_asignCom_greek_alphapro.xml");
            } catch (ClassNotFoundException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (SQLException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (UnsupportedEncodingException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (XMLStreamException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (FileNotFoundException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            }
            txtTB.append("Phân loại NSW ASWD, EXPN, SEQN...\n");
        }
        
        if(ckPhanLoaiNSWChuPro.isSelected()){
            try {
                AlphaTagPro atp = new AlphaTagPro(inf + "_punc_nsw_gr_split_group_num_splitCom_asignCom_greek.xml", inf + "_punc_nsw_gr_split_group_num_splitCom_asignCom_greek_alphapro.xml", "trainset//hand//alpha_hand.xml");
            } catch (ClassNotFoundException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (SQLException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (UnsupportedEncodingException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (XMLStreamException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (FileNotFoundException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            }
            txtTB.append("Phân loại NSW ASWD, EXPN, SEQN Pro...\n");
        }
        
        if(ckPhanLoaiNSWKhac.isSelected()){
            try {
                OtherTag otag = new OtherTag(inf + "_punc_nsw_gr_split_group_num_splitCom_asignCom_greek_alphapro.xml", inf + "_punc_nsw_gr_split_group_num_splitCom_asignCom_greek_alphapro_other.xml");
            } catch (ClassNotFoundException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (SQLException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (UnsupportedEncodingException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (XMLStreamException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (FileNotFoundException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            }
            txtTB.append("Phân loại NSW nhóm khác...\n");
        }
        
        if(ckKhoiPhucTuVietTat.isSelected()){
            try {
                Expand ex = new Expand(inf + "_punc_nsw_gr_split_group_num_splitCom_asignCom_greek_alphapro_other.xml", inf + "_punc_nsw_gr_split_group_num_splitCom_asignCom_greek_alphapro_other_expn.xml");
            } catch (XMLStreamException ex1) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex1);
            } catch (FileNotFoundException ex1) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex1);
            } catch (IOException ex1) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex1);
            } catch (ClassNotFoundException ex1) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex1);
            } catch (SQLException ex1) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex1);
            }
            txtTB.append("Khôi phục từ viết tắt...\n");
        }
        
        if(ckXacDinhCachDoc.isSelected()){
            try {
                ReadNgangCheo rnc = new ReadNgangCheo(inf + "_punc_nsw_gr_split_group_num_splitCom_asignCom_greek_alphapro_other_expn.xml", inf + "_punc_nsw_gr_split_group_num_splitCom_asignCom_greek_alphapro_other_expn_readnc.xml");
            } catch (ClassNotFoundException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (SQLException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (UnsupportedEncodingException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (XMLStreamException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (FileNotFoundException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(BuildTrainingPanel.class.getName()).log(Level.SEVERE, null, ex);
            }
            txtTB.append("Xác định cách đọc cho - và /...\n");
        }
        txtTB.append("Xong!");
         

    }//GEN-LAST:event_btnThucHienMouseClicked

    private void ckChuanPhanTachActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ckChuanPhanTachActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_ckChuanPhanTachActionPerformed

    private void ckXacDinhCachDocActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ckXacDinhCachDocActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_ckXacDinhCachDocActionPerformed

    private void ckPhatHienNhomActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ckPhatHienNhomActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_ckPhatHienNhomActionPerformed


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnChonFile;
    private javax.swing.JButton btnThucHien;
    private javax.swing.JCheckBox ckChuanPhanTach;
    private javax.swing.JCheckBox ckKhoiPhucTuVietTat;
    private javax.swing.JCheckBox ckPhanLoaiGrek;
    private javax.swing.JCheckBox ckPhanLoaiNCOM;
    private javax.swing.JCheckBox ckPhanLoaiNSWChu;
    private javax.swing.JCheckBox ckPhanLoaiNSWChuPro;
    private javax.swing.JCheckBox ckPhanLoaiNSWKhac;
    private javax.swing.JCheckBox ckPhanLoaiNSWSoSoBo;
    private javax.swing.JCheckBox ckPhanNhom;
    private javax.swing.JCheckBox ckPhanTachNCOM;
    private javax.swing.JCheckBox ckPhanTachNSW;
    private javax.swing.JCheckBox ckPhatHienNSW;
    private javax.swing.JCheckBox ckPhatHienNhom;
    private javax.swing.JCheckBox ckXacDinhCachDoc;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTextField txtFileName;
    private javax.swing.JTextArea txtTB;
    // End of variables declaration//GEN-END:variables

}
